<?php
/*
 * Created on
 * Date: 2007-12-4
 * Author: William Yang
 */
require_once(dirname(__FILE__)."/../common/constants.php");
require_once(DB_SESSION_DIR_PATH."/db_operator.php");
require_once(DB_SESSION_DIR_PATH."/db_obj_defs.php");
require_once(TRANSACTIONS_DIR_PATH."/trans_common.php");

class GeoCityManager extends GeoCity {
	public function register() {
		$stat = parent::register(CONFIGURATION_DIR_PATH."/create_geo_city.xml",
								FALSE);
		return $stat;
	}
	
	public static function queryByName($name) {
		$db_opera = new DatabaseOperator();
		$db_opera->config(CONFIGURATION_DIR_PATH."/geo_city.xml");
		$cList = new SqlCondList();
		$cList->add_condition(new SqlCondition("name", SqlCondition::EQUAL, $name));
		$rows = $db_opera->select($cList);
		
		$delegate = new GeoCity();
		if (count($rows) != 0) {
			$delegate = $delegate->array2copy($rows[0]);
		}
		return $delegate;
	}
}
?>
